Generally, a display device is equipped with a scaler. The scaler is a device for converting video signals from one resolution to another resolution according to the user's requirement. For example, after an input VGA image signal having a lower resolution (e.g. 640×480) is received by the display device, according to the user's requirement, the input VGA image signal may be processed by the scaler in order to output a processed VGA image signal having a higher resolution (e.g. 1024×768). That is, if the user wants to upscale the resolution of a frame, a scaling-up operation should be performed by the scaler. Of course, the input image signal may be converted into another format of image signal (e.g. HDTV image signal).
FIG. 1 is a schematic functional block diagram illustrating a scaler for performing a scaling-up operation according to the prior art. As shown in FIG. 1, the scaler 100 comprises a line buffer controlling unit 110, a line buffer 120, a vertical linear operating unit 130, a horizontal linear operating unit 140 and a timing generator 150.
For example, by the line buffer controlling unit 110, the line buffer 120, the vertical linear operating unit 130 and the horizontal linear operating unit 140 of the scaler 100, an original image signal is converted into an output image signal. The resolutions of the original image signal and the output image signal are different. For example, the original image signal having a lower resolution (e.g. 640×480) is converted into the output image signal having a higher resolution (e.g. 1024×768).
The timing generator 150 is configured to receive the time signal of the original image signal and convert the time signal of the original image signal into the time signal of the output image signal. The time signal of the original image signal includes for example an original V-sync signal, an original H-sync signal and an original pixel clock. The time signal of the output image signal includes for example an output V-sync signal, an output H-sync signal and an output pixel clock. A process of performing a scaling-up operation by the scaler 100 will be illustrated as follows.
When the original image signal is transmitted to the scaler 100, 480 original line data of the original image signal are successively received by the line buffer controlling unit 110 and temporarily stored in the line buffer 120. Each of the 480 original line data includes 640 three-color values. The three-color values include an R pixel value, a G pixel value and a B pixel value. If the pixel value of each color is indicated by a byte, the data amount of each original line data is equal to 1920 bytes (i.e. 640×3=1920).
Generally, the size of the line buffer 120 is sufficient to temporarily store three original line data, which have the total data amount of 5760 bytes (i.e. 1920×3=5760). For example, as shown in FIG. 1, the line buffer 120 comprises three line buffer units 122, 124 and 126. Each of the line buffer units 122, 124 and 126 can store an original line data.
For effectively utilizing the line buffer 120, after the first original line data and the second original line data have been respectively received by the first line buffer unit 122 and the second line buffer unit 124 and during the third original line data is being received by the third line buffer unit 126, the vertical linear operating unit 130 performs a linear interpolation to calculate at least one interpolated line data according to the first original line data and the second original line data outputted from the line buffer controlling unit 110. The interpolated line data is then transmitted to the horizontal linear operating unit 140.
After the third original line data has been received by the third line buffer unit 126 and during a fourth original line data is being received by the first line buffer unit 122, the vertical linear operating unit 130 performs a linear interpolation to calculate at least one interpolated line data according to the second original line data and the third original line data outputted from the line buffer controlling unit 110. The interpolated line data is then transmitted to the horizontal linear operating unit 140.
Similarly, after the fourth original line data has been received by the first line buffer unit 122 and during a fifth original line data is being received by the second line buffer unit 124, the vertical linear operating unit 130 performs a linear interpolation to calculate at least one interpolated line data according to the third original line data and the fourth original line data outputted from the line buffer controlling unit 110. The interpolated line data is then transmitted to the horizontal linear operating unit 140.
From the above discussions, at the moment when one of the line buffer units of the line buffer 120 is receiving an original line data, the two original line data stored in the other two line buffer units are transmitted to the vertical linear operating unit 130 through the line buffer controlling unit 110, and the interpolated line data is calculated by the vertical linear operating unit 130. The above steps of processing the original line data are repeatedly done until all of the 480 original line data are converted into 768 interpolated line data. That is, the 768 interpolated line data constitute an interpolated image signal.
After the interpolated line data successively outputted from the vertical linear operating unit 130 are received by the horizontal linear operating unit 140, the horizontal linear operating unit 140 performs the linear interpolations again to convert the 768 interpolated line data into 768 output line data. The 768 output line data constitute the output image signal.
That is, since the 480 original line data are converted into the 768 interpolated line data by the vertical linear operating unit 130, the interpolated image signal has a resolution of 640×768. The data amount of each interpolated line data is equal to 1920 bytes (i.e. 640×3=1920). Moreover, by the horizontal linear operating unit 140, each interpolated line data having the data amount of 1920 bytes (i.e. 640×3=1920) is converted into a corresponding output line data having the data amount of 3072 bytes (i.e. 1024×3=3072). That is, the output image signal constituted by the 768 output line data has a resolution of 10240×768.
FIGS. 2A and 2B schematically illustrate the interpolated line data generated by the vertical linear operating unit in the ideal condition. Since the 480 original line data are converted into the 768 interpolated line data by the vertical linear operating unit 130, the vertical ratio factor is equal to 5/8 (i.e. 480/768=5/8). That is, if a first length between two consecutive original line data is equal to 1 unit length and a second length between two consecutive interpolated line data is 5/8 unit length, the ratio of the second length to the first length is defined as the vertical ratio factor (5/8). The vertical linear operating unit 130 performs the linear interpolation according to the vertical ratio factor. In addition, since the length between two consecutive original line data is equal to 1 unit length, it is indicated that the length between the same pixel positions of the two consecutive original line data (e.g. the first pixel positions of the two consecutive original line data) is equal to 1 unit length.
Please refer to FIG. 2A, which schematically illustrates the relations between the positions of the original line data and the interpolated line data when the linear interpolation in the vertical direction is performed by the vertical linear operating unit. As shown in FIG. 2A, five unit lengths are equal to eight 5/8 unit lengths. That is, every 5 original line data are converted into 8 interpolated line data. Similarly, the relations between the positions of the successive original line data and interpolated line data are similar to those illustrated above, and are not redundantly described herein.
Please refer to FIG. 2B. The first-color pixel values (e.g. the red pixel values) of the first original line data L1 are successively A1, A2, A3˜A640, and the first-color pixel values of the second original line data L2 are successively B1, B2, B3˜B640. Since the first interpolated line data is separated from the first original line data L1 by 5/8 unit length, the first interpolated line data is arranged between the first original line data L1 and the second original line data L2. After the linear interpolation is performed, the first-color pixel values of the first interpolated line data l1 are obtained by a formula: an=(3/8)An+(5/8)Bn, where n is an integer from 1 to 640. That is, the first-color pixel values of the first interpolated line data l1 are determined according to the first-color pixel values at the corresponding positions of the first original line data L1 and the second original line data L2. Since the second original line data L2 is closer to the first interpolated line data l1 than the first original line data L1, the weight of the second original line data L2 is higher. Whereas, since the first original line data L1 is farther from the first interpolated line data l1 than the second original line data L2, the weight of the first original line data L1 is lower. The ways of acquiring other color pixel values (e.g. green pixel values and blue pixel values) of the first interpolated line data l1 are similar to those illustrated above, and are not redundantly described herein.
Please refer to FIG. 2B again. The first-color pixel values of the third original line data L3 are successively B1, B2, B3˜B640, and the first-color pixel values of the fourth original line data L4 are successively C1, C2, C3˜C640. Since the second interpolated line data is separated from the first original line data L1 by 10/8 unit length, the second interpolated line data is arranged between the second original line data L2 and the third original line data L3. After the linear interpolation is performed, the first-color pixel values of the second interpolated line data l2 are obtained by a formula: bn=(6/8)Bn+(2/8)Cn, where n is an integer from 1 to 640. In addition, since the third second interpolated line data is separated from the first original line data L1 by 15/8 unit length, the second interpolated line data is also arranged between the second original line data L2 and the third original line data L3. After the linear interpolation is performed, the first-color pixel values of the third interpolated line data l3 are obtained by a formula: cn=(1/8)Bn+(7/8)Cn, where n is an integer from 1 to 640.
That is, the first-color pixel values of the second interpolated line data l2 and the third interpolated line data l3 are determined according to the first-color pixel values at the corresponding positions of the second original line data L2 and the third original line data L3.
Please refer to FIG. 2B again. The first-color pixel values of the fourth original line data L4 are successively D1, D2, D3˜D640, the first-color pixel values of the fifth original line data L5 are successively E1, E2, E3˜E640, and the first-color pixel values of the sixth original line data L6 are successively F1, F2, F3˜F640. Consequently, after the linear interpolation is performed, the first-color pixel values of the fourth interpolated line data l4 are obtained by a formula: dn=(4/8)Cn+(4/8)Dn; the first-color pixel values of the fifth interpolated line data l5 are obtained by a formula: en=(7/8)Dn+(1/8)En; the first-color pixel values of the sixth interpolated line data l6 are obtained by a formula: fn=(2/8)Dn+(6/8)En; and the first-color pixel values of the seventh interpolated line data l7 are obtained by a formula: gn=(5/8)En+(3/8)Fn. In addition, the sixth interpolated line data l6 is the same as the sixth original line data L6. The above steps are repeatedly performed until all of the 768 interpolated line data are acquired.
From the above discussion, according to the vertical ratio factor, the linear interpolation in the vertical direction is performed by the vertical linear operating unit, thereby acquiring the position of the interpolated line data and the weights of two consecutive original line data. Accordingly, the contents of the interpolated line data are calculated.
FIGS. 3A and 3B schematically illustrate the output line data generated by the horizontal linear operating unit in the ideal condition. By the horizontal linear operating unit 140, the 768 interpolated line data are converted into the 768 output line data. Since each interpolated line data has the data amount of 1920 bytes (i.e. 640×3=1920) and each output line data has the data amount of 3072 bytes (i.e. 1024×3=3072), the horizontal ratio factor is equal to 5/8 (i.e. 640/1024=5/8). Moreover, the first-color pixel values (e.g. the red pixel values) of the first interpolated line data l1 are successively a1, a2, a3˜a640. After the conversion, the first-color pixel values of the first output line data ll1 are successively aa1, aa2, aa3˜aa640.
Since the length between any two adjacent first-color pixel values of the first interpolated line data l1 is equal to 1 unit length and the length between any two adjacent first-color pixel values of the first output line data ll1 is 5/8 unit length, the horizontal linear operating unit 140 performs the linear interpolation according to the horizontal ratio factor.
Please refer to FIG. 3A, which schematically illustrates the relations between the positions of the first interpolated line data and the first output line data when the linear interpolation in the vertical direction is performed by the horizontal linear operating unit. As shown in FIG. 3A, five unit lengths are equal to eight 5/8 unit lengths. That is, every 5 first-color pixel values of the first interpolated line data l1 are converted into 8 first-color pixel values of the first output line data ll1. Similarly, the relations between the positions of the successive first-color pixel values of the first interpolated line data l1 (a7-a640) and successive first-color pixel values of the first output line data ll1 (aa9˜aa1024) are similar to those illustrated above, and are not redundantly described herein.
Please refer to FIG. 3B. The first-color pixel values (e.g. the red pixel values) of the first output line data ll1 are successively a1, a2, a3˜a6. Since the first first-color pixel value aa1 of the first output line data ll1 is separated from the first first-color pixel value a1 of the first interpolated line data l1 by 5/8 unit length, the first first-color pixel value aa1 of the first output line data ll1 is arranged between the first first-color pixel value a1 and the second first-color pixel value a2 of the first interpolated line data l1. After the linear interpolation is performed, the first first-color pixel value aa1 of the first output line data ll1 is obtained by a formula: aa1=(3/8)a1+(5/8)a2. That is, the first first-color pixel value aa1 of the first output line data ll1 is determined according to the first first-color pixel value a1 and the second first-color pixel value a2 of the first interpolated line data l1. Since the first first-color pixel value aa1 of the first output line data ll1 is farther from the first first-color pixel value a1 of the first interpolated line data l1 than the second first-color pixel value a2 of the first interpolated line data l1, the weight of the first first-color pixel value a1 is lower (3/8). Whereas, since the first first-color pixel value aa1 of the first output line data ll1 is closer to the second first-color pixel value a2 of the first interpolated line data l1 than the first first-color pixel value a1 of the first interpolated line data l1, the weight of the second first-color pixel value a2 is higher (5/8).
Similarly, the second first-color pixel value aa2 of the first output line data ll1 is obtained by a formula: aa2=(6/8)a2+(2/8)a3; the third first-color pixel value aa3 of the first output line data ll1 is obtained by a formula: aa3=(1/8)a2+(7/8)a3; the fourth first-color pixel value aa4 of the first output line data ll1 is obtained by a formula: aa4=(4/8)a3+(4/8)a4; the fifth first-color pixel value aa5 of the first output line data ll1 is obtained by a formula: aa5=(7/8)a4+(1/8)a5; the sixth first-color pixel value aa6 of the first output line data ll1 is obtained by a formula: aa6=(2/8)a4+(6/8)a5; the seventh first-color pixel value aa7 of the first output line data ll1 is obtained by a formula: aa7=(5/8)a5+(3/8)a6; and the eighth first-color pixel value aa8 is equal to the sixth first-color pixel value a6 of the first interpolated line data l1.
The ways of acquiring other first-color pixel values (aa9˜aa1024) of the first output line data ll1 by converting the first-color pixel values a7˜a640 of the first interpolated line data l1 are similar to those illustrated above, and are not redundantly described herein. Moreover, the ways of acquiring other color pixel values (e.g. green pixel values and blue pixel values) of the first output line data ll1 are similar to those illustrated above, and are not redundantly described herein.
From the above discussions, according to the horizontal ratio factor, the linear interpolation in the horizontal direction is performed by the horizontal linear operating unit, thereby acquiring the position of the pixel values of the output line data and the weights of two consecutive pixel values of the interpolated line data. In such manner, all of the 1024 first-color pixel values are acquired.
As is well known, the vertical linear operating unit 130 and the horizontal linear operating unit 140 are implemented by digital circuits. In the above controlling method of the scaler, the vertical ratio factor and the horizontal ratio factor are acceptable to the digital circuits because the denominator values of the vertical ratio factor and the horizontal ratio factor are 8, which is equal to a third power of 2. As such, the ideal positions of the interpolated line data and the ideal positions of all pixel values of the output line data can be exactly realized, and the exact pixel values can be calculated by the linear interpolation.
On the other hand, if the vertical ratio factor or the horizontal ratio factor fails to be acceptable to the digital circuits during the scaling-up operation is performed by the scaler, the pixel values calculated by the linear interpolation may have errors. For example, in a case that an original image signal having a lower resolution (e.g. 640×480) is received by a display device and converted into an output image signal having a higher resolution (e.g. 1440×1050), the vertical exact ratio factor is equal to 16/35 (i.e. 480/1050=16/35) and the horizontal exact ratio factor is equal to 4/9 (i.e. 640/1440=4/9). These two ratio factors are unacceptable to the digital circuits. Since the principles of the linear interpolation in the vertical direction and the linear interpolation in the horizontal direction are identical, only the linear interpolation in the vertical direction will be illustrated as follows.
If the distance between every two original line data is 1U (unit length), the ideal positions of interpolated line data are gradually increased at an increment of 16/35U. Whereas, if the vertical linear operating unit 130 is a 10-bit operating unit, the vertical linear operating unit 130 chooses a ratio factor which is the closest to 16/35 as the vertical approached ratio factor (i.e. 468/1024). In this situation, the actual positions of interpolated line data are gradually increased at an increment of 468/1024U. Consequence, each interpolated line data results in a position error E. The position error E=Δ=(16/35)U−(468/1024)U=0.000111607U.
Since the first interpolated line data results in a position error E=Δ, all pixel values of the first interpolated line data have errors. Since the nth interpolated line data results in a position error E=n×Δ, all pixel values of the nth interpolated line data have larger errors. As the value n increase, the position error of the nth interpolated line data increases, and the pixel values of the nth interpolated line data increase.
Since the vertical exact ratio factor is equal to 16/35, it means that sixteen unit lengths (U) is equal to thirty-five (16/35)U. For avoiding infinite expansion of the position error E, the vertical linear operating unit 130 of the conventional scaler 100 has a global locking mechanism for controlling the position error E to be 34×Δ at most. In addition, all pixel values of the thirty-fifth interpolated line data are compulsorily set to be equal to all pixel values of the sixteenth original line data.
FIG. 4A is a flowchart illustrating a process for implementing a global locking mechanism of the vertical linear operating unit according to the prior art.
Firstly, in the step S410, the initial values are set, wherein n=1, unit length=U, X=0 and E=0, wherein n is a natural number, X is the actual position of the nth interpolated line data, and E is a position error.
Then, in the step S420, according to the resolutions of the original image signal and the output image signal, the vertical linear operating unit 130 acquires a vertical exact ratio factor (B/A) and a vertical approached ratio factor (C/D) and calculates an error amount Δ. For example, the vertical exact ratio factor (B/A) is 16/35, wherein A and B are natural numbers, and the numerator and the denominator of the fraction are reduced to the lowest terms. Moreover, since the vertical linear operating unit 130 is a 10-bit operating unit, the vertical approached ratio factor (C/D) is 468/1024, and the error amount Δ=(16/35)U−(468/1024)U=0.000111607U.
Then, the step S430 is performed to judge whether n is an integer multiple of A (=35). If the condition of the step S430 is satisfied, it means that the 35th interpolated line data, the 70th interpolated line data, the 105th interpolated line data, . . . , are being processed. Meanwhile, the actual positions X of these interpolated line data are compulsorily set to be equal to the integer multiple n/A of B (B=16) unit lengths (i.e. X=(n/A)BU), and the position error E is set to be 0 (Step S440). The step S440 is used for performing the global locking mechanism. On the other hand, if the condition of the step S430 is not satisfied, the step S450 is performed to gradually increase the actual position X of the nth interpolated line data at an increment of (C/D)U and continuously increase the position error E between the actual position and the ideal position at an increment Δ.
Then, in the step S460, a linear interpolation is performed according to the actual position X of the nth interpolated line data, thereby acquiring all pixel values of the nth interpolated line data.
Then, the step S470 is performed to judge whether all interpolated line data are generated. If the condition of the step S470 is not satisfied, n=n+1 (Step S480) and the step S440 is performed. Whereas, if the condition of the step S470 is satisfied, the flowchart is ended (Step S490).
In a case that the vertical exact ratio factor (B/A) is equal to 16/35, the global locking mechanism of the vertical linear operating unit 130 generates the maximum position error E (=34×Δ) for the 34th interpolated line data and the minimum position error E (=0) for the 35th interpolated line data. The position error E of the 36th interpolated line data is Δ, and the position error E is continuously added.
FIG. 4B is a schematic plot illustrating the position error resulting from a 10-bit vertical linear operating unit by utilizing the global locking mechanism to perform the linear interpolation. Obviously, since the vertical exact ratio factor is 16/35, the position error E of the 35th interpolated line data are compulsorily set to be zero by the vertical linear operating unit. In addition, the maximum position error E (=34×Δ) is accumulated for the 34th interpolated line data. Similarly, the minimum position error E (=34×Δ) is accumulated for the 69th interpolated line data, and the position error E is zero for the 35th interpolated line data. The rest will be deduced by analogy until the 768th interpolated line data.
Similarly, if the horizontal exact ratio factor is unacceptable to the horizontal linear operating unit 140, the horizontal linear operating unit 140 should produce a horizontal approached ratio factor. Under this circumstance, a position error between the actual position and the ideal position of each pixel value of the output line data is generated. When the global locking mechanism is utilized to perform the linear interpolation, the accumulated position error becomes considerably high.
As the position error increases, the pixel value obtained by the calculation of the linear interpolation is farther from the ideal pixel value. Under this circumstance, the imaging quality of the output image signal is deteriorated and the original image fails to be precisely up-scaled.
Moreover, as shown in FIG. 2A, the first original line data and the second original line data should be firstly temporarily stored in the line buffer 120 and then transmitted to the vertical linear operating unit 130 through the line buffer controlling unit 110 in order to calculate the first interpolated line data at the position of 5/8 unit line. Under this circumstance, the timing of allowing the vertical linear operating unit 130 to calculate the first interpolated line data will be delayed. In addition, the pixel values of the first interpolated line data may fail to be processed in real time.